| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 | @extends('admin/layout')@section('content')    <style>         .btn-primary, .btn-info {            background: #009688 !important;            border-color: #009688 !important;        }    </style>    @php $notCustomerBool=false @endphp    @notCustomer    @php $notCustomerBool=true @endphp    @endNotCustomer    <body class="gray-bg">    <div class="wrapper wrapper-content animated fadeInRight">        <div class="row">            <div class="col-sm-12">                <div class="ibox float-e-margins">                    <div class="ibox-content">                        <form class="row" id="searchForm" onsubmit="units.search();return false;">                            @notCustomer                            <div class="col-md-2">                                <div class="input-group">                                        <span class="input-group-btn">                                       {{--<button type="button" class="btn btn-md btn-info" id="on" ><span class="glyphicon glyphicon-hand-up"></span> 启用</button>--}}                                            {{--<button type="button" class="btn btn-md btn-warning" id="off" style="margin-left: 10px"><span class="glyphicon glyphicon-hand-down"></span> 禁用</button>--}}                                            <button type="button" class="btn btn-md btn-primary" onclick="units.save(0)"                                                    style="margin-left: 10px"> <span                                                    class="glyphicon glyphicon-plus"></span> 添加</button>                                       <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"                                               style="margin-left: 10px"><span                                               class="glyphicon glyphicon-remove"></span> 删除</button>                                   </span>                                </div>                            </div>                            @endNotCustomer                            <div class="col-md-6">                                <input type="hidden" name="status" id="status">                                <input type="hidden" name="be_applicable" id="be_applicable">                                <div class="btn-group" role="group">                                    <button type="button" class="btn btn-info" onclick="units.status(0,this)">                                        全部                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.status(1,this)">                                        待翻译                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.status(2,this)">                                        翻译中                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.status(3,this)">                                        待审核                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.status(4,this)">                                        未通过                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.status(5,this)">                                        已通过                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.status(7,this)">                                        未使用                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.toBeDetermined(0,this)">                                        待定                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.toBeDetermined(1,this)">                                        适用                                    </button>                                    <button type="button" class="btn btn-info" style="margin-left: 10px"                                            onclick="units.toBeDetermined(2,this)">                                        不适用                                    </button>                                    @notCustomer                                    <button type="button" class="btn btn-warning"                                            style="margin-left: 10px;display: none"                                            onclick="units.translate()" id="auto-translate">                                        翻译                                    </button>                                    @endNotCustomer                                </div>                            </div>                            <div class="col-md-4 pull-right">                                <div class="input-group">                                    <input type="text" placeholder="请输入标题" class="input-md form-control" name="keyword"                                           id="keyword" style="width: 200px;float: right">                                    @notCustomer                                    <input type="text" placeholder="请输入站点名称" class="input-md form-control"                                           name="site_title" id="site_title" style="width: 200px;float: right">                                    @endNotCustomer                                    <span class="input-group-btn">                                        <button type="button" class="btn btn-md btn-primary" onclick="units.search()"> 搜索</button>                                        <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"                                                name="resetBtn"> 重置</button>                                    </span>                                </div>                            </div>                            {{--<div class="col-sm-2 pull-right" style="text-align: right">--}}                            {{--<button type="button" class="btn btn-md btn-primary" id="addBtn"> 添加</button>--}}                            {{--</div>--}}                        </form>                        <hr>                        <div class="table-responsive">                            <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>                        </div>                    </div>                </div>            </div>        </div>    </div>    </body>@endsection@section('footer')    <script>        var units = {            search: function () {                tips.selectPage();            },            getIdsBySelections: function () {                var selections = $("#table").bootstrapTable('getSelections');                var ids = [];                $.each(selections, function (inx, val) {                    ids.push(val.id);                });                return ids;            },            save: function (id) {                layer.open({                    type: 2,                    content: ['/admin/articles/' + id],                    area: ['100%', '100%'],                    title: '',                    closeBtn: 0                });            },            status: function (status, _this) {                $(_this).addClass('dim');                $(_this).siblings().removeClass('dim');                $("#status").val(status);                if (status === 1) {                    $("#auto-translate").css('display', '');                } else {                    $("#auto-translate").css('display', 'none');                }                tips.tableRefresh();            },            toBeDetermined: function (be_applicable, _this) {                $(_this).addClass('dim');                $(_this).siblings().removeClass('dim');                $("#be_applicable").val(be_applicable);                if (be_applicable === 1) {                    $("#auto-translate").css('display', '');                } else {                    $("#auto-translate").css('display', 'none');                }                tips.tableRefresh();            },            translate: function () {                var ids = units.getIdsBySelections();                if (ids.length === 0) {                    layer.alert('请先选择您所要操作的对象', {icon: 0});                    return;                }                layer.confirm('您确定要翻译以下内容吗?', {icon: 3, title: '有道翻译'}, function () {                    var config = {url: '/admin/articles/auto-translate', type: 'put', data: {ids: ids}};                    tips.ajax(config);                });            },            delete: function () {                var ids = units.getIdsBySelections();                if (ids.length === 0) {                    layer.alert('请先选择您所要操作的对象', {icon: 0});                    return;                }                layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {                    layer.close(index);                    tips.ajax({                        url: '/admin/articles',                        type: 'delete',                        data: {ids: ids},                        tableRefresh: '#table'                    });                });            },            detail: function (id) {                layer.open({                    type: 2,                    content: ['/admin/articles-detail/' + id],                    area: ['100%', '100%'],                    title: '',                    closeBtn: 0                });            }        };        var config = {};        config.url = '/admin/articles';        config.columns = [ //字段            {checkbox: true},            {title: '编号', field: 'id', align: 'center'},            {                title: '标题', field: 'title', align: 'center',                formatter: function (value, row) {                    return '<a href="javascript:;" onclick="units.detail(' + row.id + ')">' + value + '</a>'                }            },            @if($notCustomerBool)            {                title: '翻译人员', field: 'translator_name', align: 'center'            },            @endif            {title: '站点名称', field: 'site_title', align: 'center'},            {title: '审核人员', field: 'auditor_name', align: 'center'},            {title: '质量分', field: 'pass_score', align: 'center'},            {title: '已翻词数', field: 'translate_words', align: 'center'},            {title: '状态', field: 'status_title', align: 'center'},            {title: '审核时间', field: 'audit_at', align: 'center'},            {title: '是否适用', field: 'be_applicable', align: 'center'},            {title: '创建时间', field: 'created_at', align: 'center'},            {                title: '操作', field: 'id', align: 'center',                formatter: function (value, row) {                    var str = '';                    // if (row.status === 1) {                    str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';                    // }                    return str;                }            }        ];        tips.bootstrapTable(config);    </script>@endsection
 |