完整版V1 加入爬虫功能
This commit is contained in:
@@ -29,14 +29,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
field: 'ticket_type',
|
||||
title: __('Ticket_type'),
|
||||
searchList: Config.ticketTypeList,
|
||||
formatter: Table.api.formatter.normal
|
||||
operate: false,
|
||||
formatter: Controller.api.formatter.ticketTypePlain
|
||||
},
|
||||
{field: 'ticket_name', title: __('Ticket_name'), operate: 'LIKE'},
|
||||
{
|
||||
field: 'link_code_text',
|
||||
title: __('Split_link_id'),
|
||||
operate: false,
|
||||
formatter: Table.api.formatter.content
|
||||
formatter: Controller.api.formatter.splitLinkCode
|
||||
},
|
||||
{
|
||||
field: 'start_time_text',
|
||||
@@ -116,6 +117,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
});
|
||||
|
||||
Table.api.bindevent(table);
|
||||
|
||||
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
|
||||
var ids = Table.api.selectedids(table);
|
||||
$('.btn-sync').toggleClass('btn-disabled disabled', ids.length === 0);
|
||||
});
|
||||
|
||||
$('.btn-sync').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var ids = Table.api.selectedids(table);
|
||||
if (!ids.length) {
|
||||
Toastr.error(__('Please select at least one record'));
|
||||
return false;
|
||||
}
|
||||
Layer.confirm(__('Sync running'), {icon: 3, title: __('Sync_status_btn')}, function (index) {
|
||||
Layer.close(index);
|
||||
var loadIdx = Layer.load(1, {shade: [0.3, '#000']});
|
||||
Fast.api.ajax({
|
||||
url: 'split.ticket/sync',
|
||||
data: {ids: ids.join(',')}
|
||||
}, function (data, ret) {
|
||||
Layer.close(loadIdx);
|
||||
table.bootstrapTable('refresh');
|
||||
return false;
|
||||
}, function () {
|
||||
Layer.close(loadIdx);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
@@ -125,6 +156,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
},
|
||||
api: {
|
||||
formatter: {
|
||||
/**
|
||||
* 工单类型:纯文本展示,无链接/标签样式
|
||||
*/
|
||||
ticketTypePlain: function (value, row) {
|
||||
var text = row.ticket_type_text != null && row.ticket_type_text !== ''
|
||||
? String(row.ticket_type_text)
|
||||
: (value != null ? String(value) : '');
|
||||
if (text === '') {
|
||||
return '<span class="text-muted">-</span>';
|
||||
}
|
||||
return '<span class="split-ticket-type-plain">' + Fast.api.escape(text) + '</span>';
|
||||
},
|
||||
/**
|
||||
* 分流链接:纯文本 + 边框背景标记,不可点击
|
||||
*/
|
||||
splitLinkCode: function (value) {
|
||||
value = value == null ? '' : String(value);
|
||||
if ($.trim(value) === '') {
|
||||
return '<span class="text-muted">-</span>';
|
||||
}
|
||||
var safe = Fast.api.escape(value);
|
||||
return '<span class="split-ticket-link-badge" style="display:inline-block;max-width:100%;padding:2px 8px;font-size:12px;line-height:1.5;color:#555;background:#f5f5f5;border:1px solid #ddd;border-radius:3px;word-break:break-all;">'
|
||||
+ safe + '</span>';
|
||||
},
|
||||
speedPerHour: function (value) {
|
||||
var num = parseFloat(value);
|
||||
if (isNaN(num)) {
|
||||
|
||||
Reference in New Issue
Block a user