duhe
2024-06-27 60ff1e8e376c8264fb34e40af72d6b3b9317e8fb
WebTM/views/»ù´¡×ÊÁÏ/É豸»ù´¡×ÊÁÏ/Gy_MaintenanceAcceptItem.html
@@ -8,7 +8,19 @@
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <style media="screen">
        .custom-tree-item-clicked {
            color: #FC9003
        }
        .layui-form-label {
            width: 40px;
            padding: 9px 5px;
        }
        .layui-input-block {
            margin-left: 50px;
        }
    </style>
</head>
<body>
@@ -31,10 +43,10 @@
                                <div class="layui-form-item" style="border-top: solid 1px #F6F6F6;">
                                    <div class="layui-row" style="padding:10px 0">
                                        <div class="layui-col-xs3 layui-inline" style="width: 23%;">
                                        <div class="layui-col-xs3 layui-inline" style="width: 23%;display:none;">
                                            <div id="treeDepartment" lay-filter="treeDepartment" class="demo-tree demo-tree-box" style="height: 520px; overflow: scroll;"></div>
                                        </div>
                                        <div class="layui-col-xs9 layui-inline">
                                        <div class="layui-col-xs12 layui-inline">
                                            <div class="layui-row">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label">代码</label>
@@ -112,6 +124,9 @@
    <script src="../../../layuiadmin/layui/zgqlayui.js"></script>
    <!--<script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>-->
    <script>
        var treeCkData = { id: 0 };
        var TagId = "";
        var TagParentId = "";
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
@@ -129,69 +144,52 @@
                , tree = layui.tree
                , util = layui.util
                //模拟数据
                , data = [
                    {
                        "id": 5,
                        "HNumber": "MJ001",
                        "title": "模具验收项目1",
                        "ParentID": 0,
                        "HLevel": 1,
                        "children": [
                            {
                                "id": 6,
                                "HNumber": "MJ002",
                                "title": "模具002",
                                "ParentID": 5,
                                "HLevel": 2
                            }
                        ]
                    }
                ]
            var sWhere = "";
            tree.render({
                elem: '#treeDepartment',
                data: getData(sWhere),
                showCheckbox: true,     //是否显示复选框
                id: 'demoId',
                isJump: false, //是否允许点击节点时弹出新窗口跳转
                showLine: true,//是否开启连接线
                click: function (obj) {
                    //获取所有选中节点id数组
                    var oCks = tree.getChecked('demoId'); //获取选中节点的数据
                    for (var i = 0; i < oCks.length; i++) {
                        //console.log(oCks[0].id, obj.data.id);
                        if (oCks[i].id != obj.data.id) {
                            console.log(oCks[i]);
                            //执行节点勾选
                            $(oCks[i]).prop("checked", false);
                            $(this).prop("checked", false);
                        }
                    }
                    form.render('checkbox');
                    //console.log(oCks);
                    //$.ajax({
                    //    url: GetWEBURL() + '/Gy_MaintenanceAcceptItem/cx',
                    //    type: "GET",
                    //    data: { "HInterID": obj.data.ID },
                    //    success: function (data1) {
                    //        if (data1.count == 1) {
                    //            option.data = data1.data;
                    //            table.render(option);
                    //            layer.close(index);
                    //        } else {
                    //            layer.close(index);
                    //            layer.alert(data1.code + data1.Message, { icon: 5 });
                    //        }
                    //    }, error: function () {
                    //        layer.close(index);
                    //        layer.alert("接口请求失败!", { icon: 5 });
                    //    }
                    //});
                }
            });
            //tree.render({
            //    elem: '#treeDepartment',
            //    data: getData(sWhere),
            //    showCheckbox: false,     //是否显示复选框
            //    id: 'demoId',
            //    isJump: false, //是否允许点击节点时弹出新窗口跳转
            //    showLine: true,//是否开启连接线
            //    onlyIconControl: true,   //点击后不收缩
            //    click: function (obj) {
            //        //点击高光
            //        if (obj.data.id !== treeCkData.id) {
            //            $('div[data-id="' + obj.data.id + '"] span').eq(1).last().addClass("custom-tree-item-clicked");
            //            $('div[data-id="' + treeCkData.id + '"] span').eq(1).last().removeClass('custom-tree-item-clicked');
            //            treeCkData = obj.data;
            //            TagId = obj.data.id;
            //            TagParentId = obj.data.ParentID;
            //        }
            //        else {
            //            $('div[data-id="' + treeCkData.id + '"] span').eq(1).last().removeClass('custom-tree-item-clicked');
            //            treeCkData = { id: 0 };
            //            TagId = "";
            //            TagParentId = "";
            //        }
            //        $.ajax({
            //            url: GetWEBURL() + '/Gy_MaintenanceAcceptItem/cx',
            //            type: "GET",
            //            data: { "HInterID": obj.data.id },
            //            success: function (data1) {
            //                if (data1.count == 1) {
            //                    option.data = data1.data;
            //                    table.render(option);
            //                    layer.close(index);
            //                } else {
            //                    layer.close(index);
            //                    layer.alert(data1.code + data1.Message, { icon: 5 });
            //                }
            //            }, error: function () {
            //                layer.close(index);
            //                layer.alert("接口请求失败!", { icon: 5 });
            //            }
            //        });
            //    }
            //});
            //$.ajax({
@@ -232,10 +230,13 @@
                //, toolbar: '#toolbarDemo'
                , height: 'full-50'
                , page: true
                , limits: [50, 500, 5000, 50000]
                , limit: 50
                , cellMinWidth: 90
                , cols: [[
                    { type: 'radio', fixed: 'left' }
                    , { field: 'HItemID', title: 'HItemID', sort: true, hide: true }
                    , { field: 'ParentID', title: 'ParentID', sort: true, hide: true }
                    , { field: '维修验收项目代码', title: '维修验收项目代码' }
                    , { field: '维修验收项目', title: '维修验收项目' }
                    , { field: '助记码', title: '助记码' }
@@ -281,7 +282,7 @@
                    shift: 2,
                    area: ['50%', '50%'],
                    maxmin: true,
                    content: '../设备基础资料/Sb_Add_MaintenanceAcceptItem.html',
                    content: ['../设备基础资料/Sb_Add_MaintenanceAcceptItem.html?hID=' + TagId + ''],
                    end: function () {
                        //刷新页面,
                        location.reload();
@@ -295,15 +296,8 @@
            //删除
            form.on('submit(btndelete)', function (obj) {
                var ModRightNameDelete = 'Gy_RepairCheck_Delete'
                //var data = obj.data //获得当前行数据
                //    , layEvent = obj.event; //获得 lay-event å¯¹åº”的值
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                var layEvent = checkStatus.event;
                if (checkStatus.data.length === 1) {
                if (TagId != "") {
                    layer.confirm('您确定要删除吗?', {
                        btn: ['确定', '取消'] //按钮
                        , yes: function (index, layero) {
@@ -312,7 +306,7 @@
                                url: GetWEBURL() + '/Gy_MaintenanceAcceptItem/Delete_Json',
                                type: "GET",
                                //async: true,
                                data: { "HItemID": data[0].HItemID, "User": sessionStorage["HUserName"], "ModRightNameDelete": ModRightNameDelete },
                                data: { "HItemID": TagId, "User": sessionStorage["HUserName"], "ModRightNameDelete": ModRightNameDelete },
                                success: function (result) {
                                    if (result.count == 1) {
                                        layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
@@ -335,8 +329,46 @@
                    });
                }
                else {
                    layer.msg('请选择一行数据编辑!');
                }
                    //var data = obj.data //获得当前行数据
                    //    , layEvent = obj.event; //获得 lay-event å¯¹åº”的值
                    var checkStatus = table.checkStatus('mainTable')
                        , data = checkStatus.data;
                    var layEvent = checkStatus.event;
                    if (checkStatus.data.length === 1) {
                        layer.confirm('您确定要删除吗?', {
                            btn: ['确定', '取消'] //按钮
                            , yes: function (index, layero) {
                                $.ajax({
                                    url: GetWEBURL() + '/Gy_MaintenanceAcceptItem/Delete_Json',
                                    type: "GET",
                                    //async: true,
                                    data: { "HItemID": data[0].HItemID, "User": sessionStorage["HUserName"], "ModRightNameDelete": ModRightNameDelete },
                                    success: function (result) {
                                        if (result.count == 1) {
                                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                                // å¾—到frame索引
                                                var index = layer.getFrameIndex(window.name);
                                                //关闭当前frame
                                                layer.close(index);
                                                //修改为功后刷新界面
                                                window.location.reload();
                                                //重载tree
                                                tree.reload('treeDepartment', {});
                                            });
                                        } else {
                                            layer.alert(result.code + result.Message, { icon: 5 });
                                        }
                                    }
                                })
                            }
                        });
                    }
                    else {
                        layer.msg('请选择一行数据编辑!');
                    }
                }
            });
@@ -375,11 +407,7 @@
            //修改按钮
            form.on('submit(btnModify)', function (data) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var hID = data[0].HItemID.toString();
                    //if (AllowLoadData(sSubStr) != false) {//非空验证
                if (TagId != "") {
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
@@ -388,7 +416,7 @@
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../设备基础资料/Sb_Add_MaintenanceAcceptItem.html??hID=' + hID + '&HType=Modify', 'yes']
                        , content: ['../设备基础资料/Sb_Add_MaintenanceAcceptItem.html?hID=' + TagId + '&HType=Modify&TagParentId=' + TagParentId +'', 'yes']
                        , resize: false,
                        end: function () {
                            //刷新页面,
@@ -398,9 +426,36 @@
                            //$(".layui-btn").removeClass("layui-btn-disabled");
                        }
                    })
                }
                else {
                    var checkStatus = table.checkStatus('mainTable')
                        , data = checkStatus.data;
                    if (checkStatus.data.length === 1) {
                        var hID = data[0].HItemID.toString();
                        TagParentId = data[0].ParentID.toString();
                        //if (AllowLoadData(sSubStr) != false) {//非空验证
                        layer.open({
                            type: 2
                            , area: ['50%', '50%']
                            , title: '编辑维修验收项目'
                            , closeBtn: 1
                            , shade: 0.6 //遮罩透明度
                            , maxmin: true //允许全屏最小化
                            , anim: 0 //0-6的动画形式,-1不开启
                            , content: ['../设备基础资料/Sb_Add_MaintenanceAcceptItem.html?hID=' + hID + '&HType=Modify&TagParentId=' + TagParentId +'', 'yes']
                            , resize: false,
                            end: function () {
                                //刷新页面,
                                location.reload();
                            }
                            , cancel: function () {
                                //$(".layui-btn").removeClass("layui-btn-disabled");
                            }
                        })
                } else {
                    layer.msg('请选择一行数据编辑!');
                    } else {
                        layer.msg('请选择一行数据编辑!');
                    }
                }
            });
@@ -415,6 +470,7 @@
            //以上是layui模块
        });
        //查询树状数据
        function getData(sWhere) {