layui.use(['table', 'jquery'], function () {
    var table = layui.table;
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        $ = layui.jquery;
    //监听表格复选框选择
    table.on('checkbox(demo)', function (obj) {
        console.log(obj)
    });
    //监听工具条
    table.on('tool(demo)', function (obj) {
        var data = obj.data;
        if (obj.event === 'edit') {
            layer.open({
                type: 2,
                anim: 4,
                scrollbar: false,
                content: '/QualityManagement/TargetManagementEdit/?callrecordsid=' + data.CallRecordsId  + '&editType=2',
                area: ['800px', '450px'],
                id: 'TargetManagementEdit',
                title: '质检管理——打分'
                , end: function () {
                    refushTreeAndData();
                }
            });
        }
        else if (obj.event === 'delete') {
            //layer.msg('ID：' + data.ProjectKey + ' 的查看操作');
            layer.confirm('确认要删除该行数据么？', function (index) {
                $.ajax({
                    url: "/SystemManage/DeleteMenuData",
                    type: "get",
                    async: false,//同步请求
                    contentType: "application/json",
                    dataType: "text",
                    cache: false,
                    data: "menuId=" + data.F_FunctionId,
                    success: function (thisResult, result) {

                        if (thisResult == "True") {
                            layer.open({
                                content: '删除成功'
                                , icon: 1
                                , btn: ['确定']
                                , yes: function (index, layero) {

                                    layer.close(index);
                                    refushTreeAndData();
                                }
                            });
                        } else {
                            layui.layer.alert("删除失败!", {
                                icon: 2
                            });

                        }
                    },
                    error: function (error) {
                        return false;
                    }
                });
                layer.close(index);
            });
        }
    });

 
});