123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- @extends('admin/site/side_layout')
- @section('header_extend')
- @endsection
- @section('right')
- <div>
- <div class="btn-group" role="group">
- <button type="button" class="btn btn-success" onclick="units.importExl()">
- 导入关键词
- </button>
- <button type="button" class="btn btn-md btn-danger" onclick="units.del()"
- style="margin-left: 10px"><span class="glyphicon glyphicon-remove"></span> 删除
- </button>
- {{-- <button type="button" class="btn btn-danger" style="margin-left: 10px"
- onclick="units.clear()">
- <span class="glyphicon glyphicon-remove"></span>清空当月关键词
- </button>--}}
- </div>
- </div>
- <div class="table-responsive">
- <table id="table" class="table table-condensed"
- data-mobile-responsive="true"></table>
- </div>
- @endsection
- @section('footer_extend')
- <script>
- var openIndex;
- var units = {
- importExl: function () {
- var str = '<div class="ibox-content" id="importLayer">' +
- '<form class="form-horizontal">' +
- '<div class="form-group">' +
- '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
- '<div class="col-sm-6">' +
- '<input type="file" id="excel_file" class="form-control">' +
- '<input type="hidden" id="excel_path">' +
- '</div>' +
- '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUpload()">上传</button></div>' +
- '</div>' +
- ' <div class="form-group">' +
- '<div class="col-sm-6 col-sm-offset-3">' +
- '<a href="{{asset('tpl/keyword_extend.xlsx')}}">请下载导入模板</a>' +
- '</div>' +
- '</div>' +
- '</form>' +
- '</div>';
- openIndex = layer.open({
- type: 1,
- content: str,
- area: ['60%', '30%'],
- title: '导入关键词'
- });
- },
- fileUpload: function () {
- var config = {
- url: '/admin/tool/excel-upload'
- };
- config.success = function (result) {
- var data = {excel_path: result.data.file_url, siteId: "{{$siteId}}"};
- var config = {
- url: '/admin/keyword-extend-import/sites/{{$siteId}}',
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- layer.close(openIndex);
- window.location.reload();
- });
- }
- };
- tips.ajax(config);
- };
- tips.fileUpload($("#excel_file"), config);
- },
- clear: function () {
- layer.confirm('您确定要清空全部关键词吗?', {icon: 3, title: '清空'}, function () {
- var config = {
- url: '/admin/keyword-extend-clear/sites/{{$siteId}}',
- type: 'delete',
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- window.location.reload();
- });
- }
- };
- tips.ajax(config);
- });
- },
- getIdsBySelections: function () {
- var selections = $("#table").bootstrapTable('getSelections');
- var ids = [];
- $.each(selections, function (inx, val) {
- ids.push(val.id);
- });
- return ids;
- },
- del: 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/keyword-extend-delete/sites/{{$siteId}}',
- type: 'post',
- data: {ids: ids},
- tableRefresh: '#table'
- });
- });
- }
- };
- var config = {};
- config.url = '/admin/keyword-extend/sites/' + "{{$siteId}}";
- config.pageSize = 20;
- config.showColumns = true;
- config.columns = [ //字段
- {checkbox: true},
- {
- title: '序号', align: 'center', formatter: function (value, item, index) {
- return index + 1;
- },
- width: '10px'
- },
- {title: '编号', field: 'id', align: 'center'},
- {title: '月份', field: 'ym', align: 'center'},
- {title: '推荐关键词', field: 'keyword', align: 'center'},
- {title: '年搜索量', field: 'search_num', align: 'center'},
- {title: '索引量', field: 'index_num', align: 'center'},
- {title: '着陆页', field: 'land_page', align: 'center'},
- {title: '创建时间', field: 'created_at', align: 'center'},
- ];
- tips.bootstrapTable(config);
- </script>
- @endsection
|